<ui:composition template="/WEB-INF/templates/public-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form id="approvetravelRequestForm">
	 <h:outputText value=" Approve Travel Request"  styleClass="outputTextTitle"/>
		
			<h:panelGrid id="dialogContent" style="width: 100%" cellspacing="5" >  
					<h:panelGrid columns="9" cellspacing="5" 
						columnClasses="employeeDetail6GridsCell1, gridCellMiddleLeftAligned, employeeDetail6GridsCell2, employeeDetail6GridsCell1, gridCellMiddleLeftAligned, employeeDetail6GridsCell2, employeeDetail6GridsCell1, gridCellMiddleLeftAligned"
						style="width: 100%; background-color: #FFE4C4; border: 1px solid #F5AD66;">
						<h:outputLabel value="Travel Request Code" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelRequestCode}" styleClass="wamOutputLebel" style="font-weight: bold; color: #7892B7"/>

						<h:outputLabel value="#{msg['employeename.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.employee.firstName} #{approveTravelRequestBean.travelRequest.employee.lastName}"
							styleClass="wamOutputLebel" />

						<h:outputLabel value="Employee Code" />
						<h:outputLabel value=":" />						
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.employee.employeeCode}"
							styleClass="wamOutputLebel" />

						<h:outputLabel value="#{msg['contactnumber.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.employee.telephone}" 
							styleClass="wamOutputLebel" />

						<h:outputLabel value="#{msg['approvalby.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.approver.firstName} #{approveTravelRequestBean.travelRequest.approver.lastName}" styleClass="wamOutputLebel" />

						<h:outputLabel value="Requested Date" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.requestDate}"
							styleClass="wamOutputLebel">
							<f:convertDateTime pattern="dd-MMM-yyyy" />
						</h:outputLabel>
					</h:panelGrid>
					
					<h:outputLabel value="Travel Details" styleClass="outputTextSubTitle" style="margin-left: 2px;"/>
		            
		            <h:panelGrid columns="9" rendered="#{approveTravelRequestBean.travelRequest.travelType eq 'DOMESTIC'}"
						columnClasses="grid96pxCellMiddleLeftAligned, gridCellMiddleLeftAligned, gridCellMiddleLeftAligned, grid96pxCellMiddleLeftAligned, gridCellMiddleLeftAligned, gridCellMiddleLeftAligned, grid96pxCellMiddleLeftAligned, gridCellMiddleLeftAligned, gridCellMiddleLeftAligned "
						style="width: 100%" cellspacing="5">
						<h:outputLabel value="#{msg['modeoftransport.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel style="width: 136px;" value="#{approveTravelRequestBean.travelRequest.travelMode}" />

						<h:outputLabel value="#{msg['natureofwork.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel style="width:136px" value="#{approveTravelRequestBean.travelRequest.natureOfWork}" />
						
						<h:outputLabel value="#{msg['emergenceycontactnum.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.emergencyContact}" mask="(999) 999-9999"/>  
						

						<h:outputLabel value="Start Date" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.periodFrom}" >
							<f:convertDateTime pattern="dd-MMM-yyyy" /> 
						</h:outputLabel>

						<h:outputLabel value="Form City" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelFrom_DO}" />

						<h:outputLabel value="Form Country" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelFromCountry_DO}" />

						<h:outputLabel value="Return Date" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.periodTo}" >
							<f:convertDateTime pattern="dd-MMM-yyyy" />
						</h:outputLabel>

						<h:outputLabel value="To City" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelTo_DO}" />

						<h:outputLabel value="To Country" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelToCountry_DO}" />

						<h:outputLabel value="#{msg['clientname.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.client}" />

						<h:outputLabel value="#{msg['clientlocation.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.clientLocation}" />

						<p:spacer />
						<p:spacer />
						<p:spacer />
						
						<h:outputLabel value="#{msg['advancerequired.label']} (INR)" />
						<h:outputLabel value=":" />
						<h:outputLabel id="advanceRequiredDOINR" value="#{approveTravelRequestBean.travelRequest.advancePaymentINR}" />
							
							
 					</h:panelGrid> 
 					
 					<!-- Overseas -->
					<h:panelGrid columns="9" rendered="#{approveTravelRequestBean.travelRequest.travelType eq 'OVERSEAS'}"
						columnClasses="grid96pxCellMiddleLeftAligned, gridCellMiddleLeftAligned, gridCellMiddleLeftAligned, grid96pxCellMiddleLeftAligned, gridCellMiddleLeftAligned, gridCellMiddleLeftAligned, grid96pxCellMiddleLeftAligned, gridCellMiddleLeftAligned, gridCellMiddleLeftAligned "
						style="width: 100%">
						<h:outputLabel value="#{msg['modeoftransport.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel style="width: 136px;" value="#{approveTravelRequestBean.travelRequest.travelMode}" />

						<h:outputLabel value="#{msg['natureofwork.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel style="width:136px" value="#{approveTravelRequestBean.travelRequest.natureOfWork}" />

						<h:outputLabel value="#{msg['emergenceycontactnum.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.emergencyContact}" mask="(999) 999-9999"/>  
						

						<h:outputLabel value="Start Date" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.periodFrom}" >
							<f:convertDateTime pattern="dd-MMM-yyyy" />
						</h:outputLabel>

						<h:outputLabel value="Form City" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelFrom_OS}" />

						<h:outputLabel value="Form Country" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelFromCountry_OS}" />

						<h:outputLabel value="Return Date" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.periodTo}" pattern="dd-MMM-yyyy">
							<f:convertDateTime pattern="dd-MMM-yyyy" />
						</h:outputLabel>

						<h:outputLabel value="To City" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelTo_OS}" />

						<h:outputLabel value="To Country" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelToCountry_OS}" />

						<h:outputLabel value="#{msg['clientname.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.client}" />

						<h:outputLabel value="#{msg['clientlocation.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.clientLocation}" />

						<p:spacer />
						<p:spacer />
						<p:spacer />
						
						<h:outputLabel value="#{msg['advancerequired.label']} (INR)" />
						<h:outputLabel value=":" />
						<h:outputLabel id="advanceRequiredOSINR" value="#{approveTravelRequestBean.travelRequest.advancePaymentINR}" mask="99999.99" />
						
						<h:outputLabel value="#{msg['advancerequired.label']} (USD)"  />
						<h:outputLabel value=":"  />
						<h:outputLabel id="advanceRequiredOSUSD" value="#{approveTravelRequestBean.travelRequest.advancePaymentUSD}" mask="99999.99"  />
												
 					</h:panelGrid> 
 					
 					<!-- BOTH -->
					<h:panelGrid columns="6" style="width: 100% " rendered="#{approveTravelRequestBean.travelRequest.travelType eq 'BOTH DOMESTIC AND OVERSEAS'}"
						columnClasses="">
						
						<h:outputLabel value="#{msg['modeoftransport.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel style="width: 136px; " value="#{approveTravelRequestBean.travelRequest.travelMode}" />

						<p:spacer />
						<p:spacer />
						<p:spacer />

						<h:outputLabel value="#{msg['natureofwork.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel style="width:136px" value="#{approveTravelRequestBean.travelRequest.natureOfWork}" />

						<h:outputLabel value="#{msg['emergenceycontactnum.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.emergencyContact}" />
							
						<h:outputLabel value="Start Date" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.periodFrom}" >
							<f:convertDateTime pattern="dd-MMM-yyyy" />
						</h:outputLabel>

						<h:outputLabel value="Return Date" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.periodTo}" >
							<f:convertDateTime pattern="dd-MMM-yyyy" />
						</h:outputLabel>

						<h:outputLabel value="Form City (Domestic)" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelFrom_DO}" />

						<h:outputLabel value="Form Country (Domestic)" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelFromCountry_DO}" />

						<h:outputLabel value="To City (Domestic)" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelTo_DO}" />

						<h:outputLabel value="To Country (Domestic)" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelToCountry_DO}" />

						<h:outputLabel value="Form City (Overseas)" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelFrom_OS}" />

						<h:outputLabel value="Form Country (Overseas)" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelFromCountry_OS}" />

						<h:outputLabel value="To City (Overseas)" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelTo_OS}" />

						<h:outputLabel value="To Country (Overseas)" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.travelToCountry_OS}" />

						<h:outputLabel value="#{msg['clientname.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.client}" />

						<h:outputLabel value="#{msg['clientlocation.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel value="#{approveTravelRequestBean.travelRequest.clientLocation}" />

						<h:outputLabel value="#{msg['advancerequired.label']}" />
						<h:outputLabel value=":" />
						<h:outputLabel id="advanceRequiredINRDNO" value="#{approveTravelRequestBean.travelRequest.advancePaymentINR}" mask="99999.99" />
							
						<h:outputLabel value="#{msg['advancerequired.label']} (USD)" >
						</h:outputLabel>
						<h:outputLabel value=":" /> 
						<h:outputLabel id="advanceRequiredUSDDNO" value="3333" mask="99999.99" />
					</h:panelGrid> 
					
					<p:spacer />
					<h:outputLabel value="Travel Logistics" styleClass="outputTextSubTitle" />
					<p:dataTable style="width: 100%; " value="#{approveTravelRequestBean.travelLogistics}" var="row" sortBy="#{row.logistics.logisticsFor}" sortOrder="ascending">
						<p:column style="width: 200px;" sortBy="#{row.logistics.displayName}" headerText="Logistics">
							<h:outputLabel value="#{row.logistics.displayName}" />
						</p:column>
						<p:column headerText="Reimbursed By" style="width: 146px;"> 
							<h:outputLabel style="width: 136px" id="reimbyrsedByMenu" styleClass="selectOneMenu168pxFixedWidth" value="#{row.byWhom}" />
						</p:column>
						
						<p:column headerText="Logistics for" style="width: 136px;" sortBy="#{row.logistics.logisticsFor}">
							<h:outputLabel id="logisticsFor" value="#{row.logistics.logisticsFor} TRAVELS" />							
						</p:column> 
						
						<p:column headerText="Remarks">
							<h:outputLabel id="remarks" cols="30" rows="1" style="width: 96%" value="#{row.remarks}" />
					
						</p:column>
					</p:dataTable>
		        </h:panelGrid> 
		        
		        <h:panelGrid columns="2" columnClasses="gridCellTopLeftAligned, gridCellTopLeftAligned" cellspacing="5">
		        	<h:outputText value="Approval comment:" /> 
		        	<p:inputTextarea id="comment" value="#{approveTravelRequestBean.travelRequest.approvalComments}" style="width: 300px;"> 
		        		<p:watermark for="comment" value="Enter a comment" />
		        	</p:inputTextarea>
		        </h:panelGrid>
		        
		        <h:panelGrid style="float: right;"  columns="2" rendered="#{approveTravelRequestBean.travelRequest.travelStatus eq 'IN PROCESS'}" >
		         	<p:commandButton value="Approve" actionListener="#{approveTravelRequestBean.approveTravelRequest}" update="@form" />
		        	<p:commandButton value="Reject" actionListener="#{approveTravelRequestBean.rejectTravelRequest}" update="@form" />		        	
		        </h:panelGrid>
		        
		        <h:panelGrid>
		        	<h:outputLabel value="Travel request #{approveTravelRequestBean.travelRequest.travelRequestCode} is #{approveTravelRequestBean.travelRequest.travelStatus}." styleClass="outputLabelwamInformation" rendered="#{approveTravelRequestBean.travelRequest.travelStatus ne 'IN PROCESS'}" />
		        </h:panelGrid>		        
			<p:growl></p:growl>
		</h:form>
	</ui:define>
</ui:composition>

